var express = require('express');
var router = express.Router();
var formidable = require('formidable');
var util = require('util');

/* GET users listing. */
router.get('/', function(req, res, next) {
   	  res.render('users',{})
 });
router.post('',function(req,res,next){
	var form = new formidable.IncomingForm();
    form.encoding = 'utf-8';
    form.uploadDir = '/Users/lanou/node/public/img/' 
    form.keepExtensions = true;
    form.parse(req, function(err, fields, files) {
    res.writeHead(200, {'content-type': 'text/plain'});
    res.write('received upload:\n\n');
    res.end(util.inspect({fields: fields, files: files}));
    });
});


module.exports = router;
